package com.ruoyi.common.core.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Email;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
 * 用户对象 sys_user
 *
 * @author ruoyi
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
    private Long userId;

    /** 部门ID */
    @Excel(name = "部门编号", type = Type.IMPORT)
    private Long deptId;

    /** 用户账号 */
    @Excel(name = "登录名称")
    private String userName;

    /** 用户昵称 */
    @Excel(name = "用户名称")
    private String nickName;

    /** 用户邮箱 */
    private String email;

    /** 手机号码 */
    @Excel(name = "手机号码")
    private String phonenumber;

    /** 用户性别 */
    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
    private String sex;

    /** 用户头像 */
    private String avatar;

    /** 密码 */
    private String password;

    /** 帐号状态（0正常 1停用） */
    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 最后登录IP */
    @Excel(name = "最后登录IP", type = Type.EXPORT)
    private String loginIp;

    /** 最后登录时间 */
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
    private Date loginDate;

    /** 部门对象 */
    private SysDept dept;

    private String roleKey;

    /** 角色对象 */
    private List<SysRole> roles;

    /** 角色组 */
    private Long[] roleIds;

    /** 岗位组 */
    private Long[] postIds;

    /** 角色ID */
    private Long roleId;

    /** 归属门店 */
    private String shopIds;

    /** 企业全称 */
    private String companyName;
    /** 工商营业执照图片地址 */
    private String compics;
    /** 统一社会信用代码 */
    private String socialCreditCode;
    /** 开户名称 */
    private String openingName;
    /** 开户银行 */
    private String openingBank;
    /** 银行账号 */
    private String bankAccount;
    /** 主体验证方式 */
    private Long verifiMethod;
    /** 联系人身份证号码 */
    private String  contactIdCard;
    /** 联系人座机 */
    private String contactTel;
    /** 法人名称 */
    private String legalName;
    /** 企业地址 */
    private String  companyAddr;

    private String encryptedPass;//小程序商家端登录密码

    private Integer companyCertified;//企业认证 0 未认证 1 已认证
    private Integer financeCertified;//财务认证 0 未认证 1 已认证
    /** 用户身份证图片地址 */
    private String idcardpics;

    private String taxIdentiNumber;//纳税识别号

    private String comOpeningBank;//企业开户行

    private String comBankAccount;//企业银行账号

    private String receivingEmail;//收票邮箱

    private String personOpeningBank;//个人开户行

    private String personBankAccount;//个人银行账号

    private String personIdCard;//个人身份证号码

    private String merchantId;//商户号

    private String legalPhone;//法人手机号

    private String legalAddr;//法人地址

    private String facialRecoPic;//人脸识别照片

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date regTime;//企业注册时间

    private BigDecimal regAmount;//企业注册资金

    private String isNotRole;//是否分配角色

    private String phonestr;

    private String code; //手机验证码

    private String userDataFilter;//用户数据过滤

    private String gpsUserName;//gps用户名称

    private String gpsPassword;//gps用户密码

    private String domainName;//gps访问的平台

    private Long platformGpsId;

    public Long getPlatformGpsId() {
        return platformGpsId;
    }

    public void setPlatformGpsId(Long platformGpsId) {
        this.platformGpsId = platformGpsId;
    }

    public String getDomainName() {
        return domainName;
    }

    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }

    public String getGpsUserName() {
        return gpsUserName;
    }

    public void setGpsUserName(String gpsUserName) {
        this.gpsUserName = gpsUserName;
    }

    public String getGpsPassword() {
        return gpsPassword;
    }

    public void setGpsPassword(String gpsPassword) {
        this.gpsPassword = gpsPassword;
    }

    public String getShopIds() {
        return shopIds;
    }

    public void setShopIds(String shopIds) {
        this.shopIds = shopIds;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getUserDataFilter() {
        return userDataFilter;
    }

    public void setUserDataFilter(String userDataFilter) {
        this.userDataFilter = userDataFilter;
    }

    public String getPhonestr() {
        return phonestr;
    }

    public void setPhonestr(String phonestr) {
        this.phonestr = phonestr;
    }

    public String getIsNotRole() {
        return isNotRole;
    }

    public void setIsNotRole(String isNotRole) {
        this.isNotRole = isNotRole;
    }

    public String getLegalPhone() {
        return legalPhone;
    }

    public void setLegalPhone(String legalPhone) {
        this.legalPhone = legalPhone;
    }

    public String getLegalAddr() {
        return legalAddr;
    }

    public void setLegalAddr(String legalAddr) {
        this.legalAddr = legalAddr;
    }

    public String getFacialRecoPic() {
        return facialRecoPic;
    }

    public void setFacialRecoPic(String facialRecoPic) {
        this.facialRecoPic = facialRecoPic;
    }

    public Date getRegTime() {
        return regTime;
    }

    public void setRegTime(Date regTime) {
        this.regTime = regTime;
    }

    public BigDecimal getRegAmount() {
        return regAmount;
    }

    public void setRegAmount(BigDecimal regAmount) {
        this.regAmount = regAmount;
    }

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }

    public String getTaxIdentiNumber() {
        return taxIdentiNumber;
    }

    public void setTaxIdentiNumber(String taxIdentiNumber) {
        this.taxIdentiNumber = taxIdentiNumber;
    }

    public String getComOpeningBank() {
        return comOpeningBank;
    }

    public void setComOpeningBank(String comOpeningBank) {
        this.comOpeningBank = comOpeningBank;
    }

    public String getComBankAccount() {
        return comBankAccount;
    }

    public void setComBankAccount(String comBankAccount) {
        this.comBankAccount = comBankAccount;
    }

    public String getReceivingEmail() {
        return receivingEmail;
    }

    public void setReceivingEmail(String receivingEmail) {
        this.receivingEmail = receivingEmail;
    }

    public String getPersonOpeningBank() {
        return personOpeningBank;
    }

    public void setPersonOpeningBank(String personOpeningBank) {
        this.personOpeningBank = personOpeningBank;
    }

    public String getPersonBankAccount() {
        return personBankAccount;
    }

    public void setPersonBankAccount(String personBankAccount) {
        this.personBankAccount = personBankAccount;
    }

    public String getPersonIdCard() {
        return personIdCard;
    }

    public void setPersonIdCard(String personIdCard) {
        this.personIdCard = personIdCard;
    }

    public String getLegalName() {
        return legalName;
    }

    public void setLegalName(String legalName) {
        this.legalName = legalName;
    }

    public String getCompanyAddr() {
        return companyAddr;
    }

    public void setCompanyAddr(String companyAddr) {
        this.companyAddr = companyAddr;
    }

    public String getIdcardpics() {
        return idcardpics;
    }

    public void setIdcardpics(String idcardpics) {
        this.idcardpics = idcardpics;
    }

    public Integer getCompanyCertified() {
        return companyCertified;
    }

    public void setCompanyCertified(Integer companyCertified) {
        this.companyCertified = companyCertified;
    }

    public Integer getFinanceCertified() {
        return financeCertified;
    }

    public void setFinanceCertified(Integer financeCertified) {
        this.financeCertified = financeCertified;
    }

    public String getEncryptedPass() {
        return encryptedPass;
    }

    public void setEncryptedPass(String encryptedPass) {
        this.encryptedPass = encryptedPass;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompics() {
        return compics;
    }

    public void setCompics(String compics) {
        this.compics = compics;
    }

    public String getSocialCreditCode() {
        return socialCreditCode;
    }

    public void setSocialCreditCode(String socialCreditCode) {
        this.socialCreditCode = socialCreditCode;
    }

    public String getOpeningName() {
        return openingName;
    }

    public void setOpeningName(String openingName) {
        this.openingName = openingName;
    }

    public String getOpeningBank() {
        return openingBank;
    }

    public void setOpeningBank(String openingBank) {
        this.openingBank = openingBank;
    }

    public String getBankAccount() {
        return bankAccount;
    }

    public void setBankAccount(String bankAccount) {
        this.bankAccount = bankAccount;
    }

    public Long getVerifiMethod() {
        return verifiMethod;
    }

    public void setVerifiMethod(Long verifiMethod) {
        this.verifiMethod = verifiMethod;
    }


    public String getContactIdCard() {
        return contactIdCard;
    }

    public void setContactIdCard(String contactIdCard) {
        this.contactIdCard = contactIdCard;
    }


    public String getContactTel() {
        return contactTel;
    }

    public void setContactTel(String contactTel) {
        this.contactTel = contactTel;
    }

    public SysUser()
    {

    }

    public String getRoleKey() {
        return roleKey;
    }

    public void setRoleKey(String roleKey) {
        this.roleKey = roleKey;
    }

    public SysUser(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public boolean isAdmin()
    {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }

    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    public String getNickName()
    {
        return nickName;
    }

    public void setNickName(String nickName)
    {
        this.nickName = nickName;
    }

    @Xss(message = "用户账号不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    public String getUserName()
    {
        return userName;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhonenumber()
    {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber)
    {
        this.phonenumber = phonenumber;
    }

    public String getSex()
    {
        return sex;
    }

    public void setSex(String sex)
    {
        this.sex = sex;
    }

    public String getAvatar()
    {
        return avatar;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public SysDept getDept()
    {
        return dept;
    }

    public void setDept(SysDept dept)
    {
        this.dept = dept;
    }

    public List<SysRole> getRoles()
    {
        return roles;
    }

    public void setRoles(List<SysRole> roles)
    {
        this.roles = roles;
    }

    public Long[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds) {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

    public Long getRoleId()
    {
        return roleId;
    }

    public void setRoleId(Long roleId)
    {
        this.roleId = roleId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("userId", getUserId())
                .append("deptId", getDeptId())
                .append("userName", getUserName())
                .append("nickName", getNickName())
                .append("email", getEmail())
                .append("phonenumber", getPhonenumber())
                .append("sex", getSex())
                .append("avatar", getAvatar())
                .append("password", getPassword())
                .append("status", getStatus())
                .append("delFlag", getDelFlag())
                .append("loginIp", getLoginIp())
                .append("loginDate", getLoginDate())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .append("dept", getDept())
                .toString();
    }
}